/*
 * Copyright (c) 2025 UCT Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
*/

import { common } from '@kit.AbilityKit';
import { _TableName_TitleView, _TableName_ListView } from 'commondb';
import { _table_name_, getDB, Env } from 'commondb';
import {
  ColumnType,
  EventParamsBaseType,
  IEventSender,
  ILog,
  Migration,
  Rdb,
  RdbDao,
  RdbDatabase
} from 'rdbstore';

@Entry
@ComponentV2
export struct _TableName_ListPage {
  private context = getContext(this) as common.UIAbilityContext;
  @Provider() _table_name_List: _table_name_[] =  [new _table_name_()];

  async aboutToAppear() {
    // 初始化加载数据
    let db: RdbDatabase = getDB(Env.DATABASE_UCTOO_NAME);
    let _table_name_Dao: RdbDao<_table_name_> = await db.getDao(_table_name_);
    this._table_name_List = await _table_name_Dao.queryAllSync();
  }

  async onPageShow() {

  }

  build() {
    Column() {
      _TableName_TitleView();
      _TableName_ListView();
    }
    .height('100%')
    .width('100%')
    .alignItems(HorizontalAlign.Start)
    .margin({ left: 15 })
  }
}